<template>
    <div class="main">
        <banner></banner>
        <div class="pd20">
            <div class="btn-box">
                <mt-button type="primary" size="large" @click.native="goUrl('queue')">我的排队</mt-button>
            </div>
            <div class="btn-box">
                <mt-button type="primary" size="large" @click.native="checkIn()">我要排队</mt-button>
            </div>
            <div class="btn-box">
                <mt-button type="danger" size="large" @click.native="exit()"><i class="fa fa-remove"></i> 退出登录</mt-button>
            </div>
        </div>
    </div>
    
</template>

<script>
import banner from '../components/banner.vue'
import { MessageBox } from 'mint-ui'
export default {
    name: 'index',

    data () {
        return {
            // vuexname: this.$store.state.name
        }
    },

    mounted() {
        
    },
    
    methods: {
        exit () {
            this.$cookies.set('token', '', -1000)
            this.$cookies.set('refreshToken', '', -1000)
            this.goUrl('mobile')
        },

        createQue () {
            this.getHeaders()
            let ts = this
            let api = this.getApi('createQue')
            this.$ajax({
                method: 'POST',
                url: api,
                data: '',
                headers: this.headers,
            }).then(function(res){
                if(res.data.code){
                    ts.goUrl('queue')
                }else{
                    messageBox('提示', res.data.msg)
                }
            }).catch(function(error){
                console.log(error)
            })
        }
    },
    components: {banner}
}
</script>